<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <title>修改昵称</title>
    <link rel="stylesheet" href="__CSS__/login_register.css">
</head>
<body style="margin: 0;padding: 0;background-color: #f3f3f3;">
<div class="topbar-between gradient-color horizontal-view">
    <div class="topbar-back" onclick="location.href='/Wx/Login/userInfo' ">
        <div class="topbar-back-icon"></div>
    </div>
    <div class="topbar-title">修改昵称</div>
    <div style="width: 2.5rem;"></div>
</div>
<input name="nickname" id="nickname" value="{$nickname}" class="input-simple" style="margin-top: 10px" type="text" maxlength="20">
<p style="padding-left: 1rem;line-height: 30px;font-size: 0.6rem;color: gray;">建议：中文请使用2-6个汉字</p>
<div class="button-simple-color position-fixed-bottom" onclick="save()">保存</div>
<script src="__JS__/jquery2.1.1.min.js"></script>
<script src="__JS__/layer.min.js"></script>
<script type="text/javascript">
function save() {
    var url = "/Wx/Login/nicknameHandle";
    var nickname = $.trim($('#nickname').val());
    if(nickname==''){
        layer.msg('昵称不能为空');
        return;
    }
    $.ajax({
        type : "POST",
        url : url,
        data : {
            nickname : nickname,
        },
        dataType : "json",
        success : function(data) {
            try {
                if (data.status == 0) {
                    layer.msg('昵称修改成功');
                    setTimeout(function(){
                        location.href="/Wx/Login/userInfo";
                    },2000);
                }else{
                    layer.msg('昵称修改失败');
                }
            } catch (err) {

            }
        }
    });
}
</script>
</body>
</html>